#!/bin/bash

f1() {
  local t1 t2 t3
  t1='Python 3.9.5'
  t2="${t1#*Python}"
  t3=${t2// /}
  old_ver=${t3:0:3}
  #  return "$old_ver"
}

f2() {
  echo "$t1"
  echo "$old_ver"
}

f1
f2